<include file="Public/min-header" />
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <nav class="navbar navbar-default">
                        <div class="collapse navbar-collapse">
                            <div class="navbar-form pull-right margin">
                                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                            </div>
                        </div>
                    </nav>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title text-center">基本信息</h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th class = "text-center">订单 ID:</th>
                                    <th class = "text-center">订单号:</th>
                                    <th class = "text-center">会员:</th>
                                    <th class = "text-center">电话:</th>
                                    <th class = "text-center">应付:</th>
                                    <th class = "text-center">订单 状态:</th>
                                    <th class = "text-center">下单时间:</th>
                                    <th class = "text-center">支付时间:</th>
                                    <th class = "text-center">支付方式:</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td class = "text-center">{$order.id}</td>
                                    <td>{$order.order_sn}</td>
                                    <td><a href="#" target="_blank">{$order.consignee}</a></td>
                                    <td>{$order.mobile}</td>
                                    <td class = "text-right">{$order.price}</td>
                                    <td id="order-status">
                                        <if condition="$order['order_status'] eq 1">
											<span style="color:red;">已发货</span>
										<elseif condition="$order['order_status'] eq 2" />
											<span style="color:red;">交易完成</span>
										<elseif condition="$order['order_status'] eq 3" />
											<span style="color:orange;">已取消</span>
										<else />
											<span style="color:green;">待发货</span>
										</if>
                                    </td>
                                    <td class = "text-center">{$order.add_time|date='Y-m-d H:i',###}</td>
                                    <td>
                                        <if condition="$order.pay_time neq 0">
                                            {$order.pay_time|date='Y-m-d H:i',###}
                                            <else/> N
                                        </if>
                                    </td>
                                    <td id="pay-type">
                                        {$order.pay_name}
                                    </td>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title text-center">收货信息</h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th class = "text-center">收货人:</th>
                                    <th class = "text-center">联系方式:</th>
                                    <th class = "text-center">地址:</th>
                                    <th class = "text-center">配送方式:</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>{$order.consignee}</td>
                                    <td>{$order.mobile}</td>
                                    <td>{$order.address}</td>
                                    <td>快递配送</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title text-center">商品信息 </h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th class="text-center">商品</th>
                                    <th class="text-center">出品者</th>
                                    <th class="text-center">数量</th>
                                    <th class="text-center">单品价格</th>
                                    <th class="text-center">单品小计</th>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="orderGoods" id="good">
                                    <tr>
                                        <td class="text-left">
											<img src="{$good.thumb}" height="25">
											{$good.title}</td>
                                        <td class="text-left">{$good.store_name}</td>
                                        <td class="text-left">{$good.goods_number}</td>
                                        <td class="text-right">{$good.price}</td>
                                        <td class="text-right">{$good['goods_number']*$good['price']}</td>
                                    </tr>
                                </volist>
                                <tr>
                                    <td colspan="4" class="text-right">小计:</td>
                                    <td class="text-right">{$order.price}</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title text-center">费用信息</h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th class="text-center">小计:</th>
                                    <th class="text-center">运费:</th>
                                    <th class="text-center">应付:</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td class="text-right">{$order.price}</td>
                                    <td class="text-right">+0</td>
                                    <td class="text-right">{$order.price}</td>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title text-center">操作信息</h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <div class="row">
                                        <td class="text-right col-sm-2">
                                            <p class="margin">操作备注：</p>
                                        </td>
                                        <td colspan="3">
                                            <form id="order-action">
                                                <textarea id="resume" placeholder="请输入操作备注" rows="3" class="form-control"></textarea>
                                            </form>
                                        </td>
                                    </div>
                                </tr>
                                <tr>
                                    <div class="row">
                                        <td class="text-right col-sm-2">
                                            <p class="margin">当前可执行操作：</p>
                                        </td>
                                        <td colspan="3">
                                            <div class="input-group">
                                                <if condition="$order['order_status'] lt 1">
                                                    <a class="btn btn-primary margin" onclick="deliveryInfo({$order['id']});">发货</a>
                                                </if>
                                            </div>
                                        </td>
                                    </div>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title text-center">操作记录</h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th class="text-center">操作者</th>
                                    <th class="text-center">操作时间</th>
                                    <th class="text-center">订单状态</th>
                                    <th class="text-center">备注</th>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="action_log" id="log">
                                    <tr>
                                        <td class="text-center">{$log.username}</td>
                                        <td class="text-center">{$log.add_time|date='Y-m-d H:i:s',###}</td>
                                        <td class="text-center">
                                            <if condition="$log['order_status'] eq 1">
												<span style="color:red;">已发货</span>
											<elseif condition="$log['order_status'] eq 2" />
												<span style="color:red;">交易完成</span>
											<elseif condition="$log['order_status'] eq 3" />
												<span style="color:orange;">已取消</span>
											<else />
												<span style="color:green;">待发货</span>
											</if>
                                        </td>
                                        <td class="text-center">{$log.resume}</td>
                                    </tr>
                                </volist>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
</body>
<script>
    function deliveryInfo(id) {
        layer.open({
            content: '您确定要发货吗？'
            ,btn: ['确定', '不要']
            ,yes: function(index){
                var resume = $('#resume').val();
                $.post('/Admin/Order/deliveryInfo/',{order_id:id,resume:resume},function(data){
                    if(data.code==200){
                        window.location = '/Admin/Order/detail/id/'+id;
                    }
                },'json');
            }
        });
    }
</script>
</html>
